<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">











<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>Maven Minify Plugin - Usage</title>
    <style type="text/css" media="all">
      @import url("./css/maven-base.css");
      @import url("./css/maven-theme.css");
      @import url("./css/site.css");
    </style>
    <link rel="stylesheet" href="./css/print.css" type="text/css" media="print" />
          <meta name="author" content="Samuel Santos" />
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
      </head>
  <body class="composite">
    <div id="banner">
                    <span id="bannerLeft">
    
            Maven Minify Plugin
    
            </span>
                    <div class="clear">
        <hr/>
      </div>
    </div>
    <div id="breadcrumbs">
          
  

  
    
  
  
    
            <div class="xleft">
        Last Published: 2010-04-26
                      </div>
            <div class="xright">      
  

  
    
  
  
    
  </div>
      <div class="clear">
        <hr/>
      </div>
    </div>
    <div id="leftColumn">
      <div id="navcolumn">
           
  

  
    
  
  
    
                   <h5>Overview</h5>
            <ul>
              
    <li class="none">
                    <a href="index.html">Introduction</a>
          </li>
              
    <li class="none">
                    <a href="plugin-info.html">Goals</a>
          </li>
              
    <li class="none">
              <strong>Usage</strong>
        </li>
          </ul>
              <h5>Examples</h5>
            <ul>
              
    <li class="none">
                    <a href="examples/basic.html">Basic Configuration</a>
          </li>
              
    <li class="none">
                    <a href="examples/binding.html">Binding to a Phase in the Project Build Cycle</a>
          </li>
              
    <li class="none">
                    <a href="examples/exclude.html">Exclude source files from the WAR package</a>
          </li>
          </ul>
              <h5>Project Documentation</h5>
            <ul>
              
                
              
      
            
      
            
      
            
      
            
      
            
      
            
      
            
      
            
      
            
      
              
        <li class="collapsed">
                    <a href="project-info.html">Project Information</a>
                </li>
              
                
              
      
            
      
            
      
              
        <li class="collapsed">
                    <a href="project-reports.html">Project Reports</a>
                </li>
          </ul>
                                           <a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy">
            <img alt="Built by Maven" src="./images/logos/maven-feather.png"></img>
          </a>
                       
  

  
    
  
  
    
        </div>
    </div>
    <div id="bodyColumn">
      <div id="contentBox">
        <div class="section"><h2>Usage</h2>
<p>This document is intended to provide instructions for using the Maven Minify Plugin. In order for this discussion to be useful, it's critical to cover two topics: Configuring your project's <tt>pom.xml</tt> to run the plugin during the build and using the plugin from the command-line.</p>
<div class="section"><h3>Basic configuration</h3>
<p>The recommended basic configuration.</p>
<div class="source"><pre>&lt;project&gt;
  ...
  &lt;build&gt;
    &lt;plugins&gt;
      ...
      &lt;plugin&gt;
        &lt;groupId&gt;com.samaxes.maven&lt;/groupId&gt;
        &lt;artifactId&gt;maven-minify-plugin&lt;/artifactId&gt;
        &lt;version&gt;1.2-SNAPSHOT&lt;/version&gt;
        &lt;configuration&gt;
          &lt;cssSourceFiles&gt;
            &lt;param&gt;file-1.css&lt;/param&gt;
            ...
            &lt;param&gt;file-n.css&lt;/param&gt;
          &lt;/cssSourceFiles&gt;
          &lt;jsSourceFiles&gt;
            &lt;param&gt;file-1.js&lt;/param&gt;
            ...
            &lt;param&gt;file-n.js&lt;/param&gt;
          &lt;/jsSourceFiles&gt;
        &lt;/configuration&gt;
      &lt;/plugin&gt;
      ...
    &lt;/plugins&gt;
  &lt;/build&gt;
  ...
&lt;/project&gt;</pre>
</div>
</div>
<div class="section"><h3>Complete configuration</h3>
<p>In case you need more flexibility, this configuration shows all the possible configuration parameters.</p>
<div class="source"><pre>&lt;project&gt;
  ...
  &lt;build&gt;
    &lt;plugins&gt;
      ...
      &lt;plugin&gt;
        &lt;groupId&gt;com.samaxes.maven&lt;/groupId&gt;
        &lt;artifactId&gt;maven-minify-plugin&lt;/artifactId&gt;
        &lt;version&gt;1.2-SNAPSHOT&lt;/version&gt;
        &lt;configuration&gt;
          &lt;webappSourceDir&gt;${basedir}/src/main/webapp&lt;/webappSourceDir&gt;
          &lt;webappTargetDir&gt;${project.build.directory}/${project.build.finalName}&lt;/webappTargetDir&gt;
          &lt;cssSourceDir&gt;css&lt;/cssSourceDir&gt;
          &lt;jsSourceDir&gt;js&lt;/jsSourceDir&gt;
          &lt;cssSourceFiles&gt;
            &lt;param&gt;file-1.css&lt;/param&gt;
            ...
            &lt;param&gt;file-n.css&lt;/param&gt;
          &lt;/cssSourceFiles&gt;
          &lt;jsSourceFiles&gt;
            &lt;param&gt;file-1.js&lt;/param&gt;
            ...
            &lt;param&gt;file-n.js&lt;/param&gt;
          &lt;/jsSourceFiles&gt;
          &lt;cssSourceIncludes&gt;**&lt;/cssSourceIncludes&gt;
          &lt;cssSourceExcludes&gt;fileToExclude.css&lt;/cssSourceExcludes&gt;
          &lt;jsSourceIncludes&gt;**&lt;/jsSourceIncludes&gt;
          &lt;jsSourceExcludes&gt;fileToExclude.js&lt;/jsSourceExcludes&gt;
          &lt;cssFinalFile&gt;style.css&lt;/cssFinalFile&gt;
          &lt;jsFinalFile&gt;script.js&lt;/jsFinalFile&gt;
          &lt;linebreak&gt;-1&lt;/linebreak&gt;
          &lt;nomunge&gt;false&lt;/nomunge&gt;
          &lt;verbose&gt;false&lt;/verbose&gt;
          &lt;preserveAllSemiColons&gt;false&lt;/preserveAllSemiColons&gt;
          &lt;disableOptimizations&gt;false&lt;/disableOptimizations&gt;
          &lt;bufferSize&gt;4096&lt;/bufferSize&gt;
        &lt;/configuration&gt;
      &lt;/plugin&gt;
      ...
    &lt;/plugins&gt;
  &lt;/build&gt;
  ...
&lt;/project&gt;</pre>
</div>
</div>
<div class="section"><h3>Using the plugin from the command-line</h3>
<p>The Maven Minify Plugin is easily executed from the command line since it can run without any parameter configuration.</p>
<div class="source"><pre>mvn minify:minify</pre>
</div>
</div>
</div>

      </div>
    </div>
    <div class="clear">
      <hr/>
    </div>
    <div id="footer">
      <div class="xright">&#169;  
          2010
    
          samaxes
          
  

  
    
  
  
    
  </div>
      <div class="clear">
        <hr/>
      </div>
    </div>
  </body>
</html>
